import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int b1 = sc.nextInt();
        BankAccount b = new BankAccount(b1);
        int count = sc.nextInt();
        for (int i = 0; i < count; i++) {
            int select = sc.nextInt();
            int money = sc.nextInt();
            if(select == 1){
                System.out.println(b.deposit(money));
            } else if (select == 2) {
                System.out.println(b.withdraw(money));
            }
        }
    }
}
class BankAccount{
    private int balance;
    public BankAccount(){
        this.balance = 0;
    }
    public BankAccount(int money){
        this.balance = money;
    }

    public int getBalance() {
        return balance;
    }

    public void setBalance(int balance) {
        this.balance = balance;
    }
    public int withdraw(int amount){
        if(this.balance >= amount){
            this.balance -= amount;
        }
        return this.balance;
    }
    public int deposit(int amount){
        this.balance += amount;
        return this.balance;
    }
}
